package com.example.springbootdemo.controller;

import com.example.springbootdemo.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description TODO
 * @Author masiyi
 * @Date 2022/12/21
 **/
@RestController
public class Test {

    @Autowired
    private TestService testService;

    /**
     * 不走缓存
     * @return string
     */
    @GetMapping("/testnocache")
    public String testnocache() {
        return testService.testnocache();
    }

    @GetMapping("/test")
    /**
     * 走缓存
     * @return string
     */
    public String test() {
        return testService.test();
    }

    /**
     * 缓存带参数方法
     * @return string
     */
    @GetMapping("/testParams")
    public Object testParams(@RequestParam String name,@RequestParam String sex) {
        return testService.testParams(name,sex);
    }


}
